home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / tidy-1.000 / tidy-1 / tidy-1.0 / install-test < prev    next >
Encoding:
Text File  |  1996-03-12  |  3.1 KB  |  115 lines

  1. #!/usr/local/bin/perl -w
  2.  
  3. # You may have to edit these.
  4. # Althogh `ps' is available almost everywhere, it may need different
  5. # switches. Use those that tell ps to display ALL processes.
  6. # `whereis' looks for executables in binary paths.
  7. # S_CONF is the most probable location of syslog.conf
  8.  
  9. $PS      = "ps ax";  # Linux
  10. # $PS    = "ps -ef"; # IRIX
  11. $WHEREIS = "whereis -b syslogd";
  12. $S_CONF  = "/etc/syslog.conf";
  13.  
  14. #-----------------------------------------------------------------------
  15.  
  16. print "Tidy 1.0 Installation Test Utility\n\nChecking...\n";
  17. $problems ='';
  18.  
  19. # Perl Version
  20. if ( $] >= 5.0 ) {
  21.     print "\nPerl $] is OK.\n";
  22.     }
  23. else {
  24.     print "\nERROR: tidy NEEDS Perl v5. Please upgrade.\n"; exit 1;
  25.     }
  26.  
  27. # syslogd running?
  28. @_ = `$PS`;
  29. $found = 0;
  30. foreach (@_) {
  31.     chop;
  32.     if ( /syslogd/ ) {
  33.         print "\nsyslogd is running (ps: $_)\n";
  34.         $found = 1;
  35.         }
  36.     }
  37. if ($found == 0) {
  38.     print "\nWARNING: syslogd does not seem to be active\n";
  39.     $problems .= "NOT_RUNNING ";
  40.     $_ = `$WHEREIS`;
  41.     if ( /\// ) { # LTS
  42.         print "... but you seem to have it: $_\n";
  43.         }
  44.     else {
  45.         print "\nERROR: syslogd not found\n";
  46.         $problems .= "NO_SYSLOGD ";
  47.         }
  48.     }
  49.  
  50. if (-e "$S_CONF") {
  51.     print "\nFound $S_CONF\n";
  52.     if (-r "$S_CONF") {
  53.         open ( Conf, "<$S_CONF" );
  54.         print "\nReading syslog.conf...\n\n";
  55.         while ( <Conf> ) {
  56.             if (! /^\s*#/ ) {
  57.                 if ( /(.+?)\s+(.+)/ ) {
  58.                     $what = $1; $act = $2;
  59.                     foreach ( split ( ';', $what ) ) {
  60.                         if ( /(mail|\*)\.(\S+)/ ) {
  61.                             $fac = $1; $lev = $2;
  62.                             if ( "$act" =~ /(\/[\w.\/-]+)/ ) { # LTS
  63.                                 print "syslog.conf: Facility $fac Level $lev is being logged to file $1. Good!\n             Try this file as the `logfile'\n";
  64.                                 }
  65.                             else {
  66.                                 print "syslog.conf: Facility $fac Level $lev has Action $act. Maybe bad.\n";
  67.                                 $problems .= "ACTION ";
  68.                                 }
  69.                             }
  70.                         }
  71.                     }
  72.                 }
  73.             }
  74.         close ( Conf );
  75.         }
  76.     else {
  77.         print "\nWARNING: Cannot read syslog.conf. Do you have permission?\n";
  78.         }
  79.     }
  80. else {
  81.     print "\nERROR: syslog.conf not found\n";
  82.     $problems .= "NO_CONF ";
  83.     }
  84.  
  85. if ( $problems =~ /NOT_RUNNING/ ) {
  86.     print <<"EOF";
  87. Problem: syslogd is not running. Either you have to edit your syslog.conf
  88.          and restart it or you don't have syslogd.
  89. EOF
  90.     }
  91. if ( $problems =~ /NO_SYSLOGD/ ) {
  92.     print <<"EOF";
  93. Problem: syslogd not found in your binary paths. Maybe you have to add
  94.          /usr/sbin or /etc or ... to your PATH environment. If you cannot
  95.          find it on your system, try to get it via ftp and install it.
  96. EOF
  97.     }
  98. if ( $problems =~ /NO_CONF/ ) {
  99.     print <<"EOF";
  100. Problem: $S_CONF not found. Either you do not have syslogd (see above)
  101.          or you are using another syslog.conf. If this is the case, edit
  102.          install-test and specify the correct path to syslog.conf an rerun
  103.          this script.
  104. EOF
  105.     }
  106. if ( $problems =~ /ACTION/ ) {
  107.     print <<"EOF";
  108. Problem: (possible) The messages from the mail (or all) facilities is not
  109.          logged to a file but somewhere else. You may want to edit
  110.          syslog.conf and specify a file, where the messages are logged to
  111.          which will be processed by tidy. Refer to syslog.conf(5)
  112. EOF
  113.     }
  114.  
  115.